<html>
<head>
    <title>移动教学信息管理系统 - 后台</title>
    <link href="/static/css/semantic.css" rel="stylesheet"/>
    <style>
        body{font-family: "Microsoft YaHei" !important;}
        body {
            background-color: #FFFFFF;
        }
        .ui.menu .item img.logo {
            margin-right: 1.5em;
        }
        .main.container {
            margin-top: 7em;
        }
        .wireframe {
            margin-top: 2em;
        }
        .ui.footer.segment {
            margin: 5em 0em 0em;
            padding: 5em 0em;
        }
    </style>
</head>
<body>
<table class="ui celled striped table">
    <thead>
    <tr><th colspan="4">反馈管理
        <button class="button ui primary" onclick="$('.ui.modal').modal('show');">添加</button>
    </th>
    </tr>
    <tr>
        <th>ID</th>
        <th>内容</th>
    </tr>
    </thead>
    <tbody>

    <#list list as i>
    <tr>
        <td class="collapsing"> ${i.id} </td>
        <td>${i.content!}</td>
        <td class="right aligned collapsing">
            <button class="button ui orange" onclick="$('.ui.modal').modal('show');onUpdate('${i.id!}','${i.content!}')">修改</button>
            <button class="button ui red" onclick="del('${i.id}')">删除</button>
        </td>
    </tr>
    </#list>
    </tbody>
</table>
<div class="ui modal" style="width: 300px; padding: 15px;margin-left: -200px">
    <form class="ui form five" method="post" action="/feedback/add" form-ajax forward=" ">
        <input type="hidden" name="id"/>
        <div class="field">
            <input type="text" name="content" placeholder="反馈内容">
        </div>
        <button class="ui button primary" type="submit">提交</button>
        <button class="ui button" type="button" onclick="$('.ui.modal').modal('hide');">取消</button>
    </form>
</div>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/semantic.min.js"></script>
<script type="text/javascript" src="/static/js/form-ajax.js"></script>
<script type="text/javascript" src="/static/js/jquery.validate.min.js"></script>
<script type="text/javascript">
    function onUpdate(id,content) {
        $('input[name=id]').val(id);
        $('input[name=content]').val(content);
    }
    function del(id) {
        $.post('/feedback/delete/'+id,function (data) {
            alert('删除成功');
            location.reload();
        })
    }
</script>
</body>
</html>